package qlhr.com.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import qlhr.com.common.utils.EasyUIResult;
import qlhr.com.mapper.TbItemMapper;
import qlhr.com.pojo.TbItem;
import qlhr.com.service.TbItemService;

@Service
public class TbItemServiceImpl implements TbItemService{
	
	@Autowired
	private TbItemMapper tbItemMapper;

	@Override
	public TbItem findById(Long id) {
		TbItem tbItem = tbItemMapper.selectByPrimaryKey(id);
		return tbItem;
	}
	
	//分页

	@Override
	public EasyUIResult findPageQuery(Integer page, Integer rows) {
		if(page!=null && rows!=null && !page.equals("") && !rows.equals("")) {
			int total = tbItemMapper.countByExample(null);
			int start = (page-1)*rows;
			List<TbItem> list = tbItemMapper.selectPageQuery(start, rows);
			EasyUIResult result = new EasyUIResult(total, list);
			
			
			return result;
		}else {
			
			return null;
		}
	}

}
